package com.bascker.algorithm.common.util;

/**
 * 计时器
 *
 * @apiNote from 算法4
 */
public class TimeWatcher {

    private final long start;

    public TimeWatcher() {
        start = System.currentTimeMillis();
    }

    /**
     * 返回计时器创建以来经过的时间
     */
    public double elapsedTime() {
        final long now = System.currentTimeMillis();
        return (now - start) / 1000.0;
    }

}
